#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

using namespace std;

const int INF = 1000000000;
const int N = 102;

int h, w;
char mapData[N][N];
int gx, gy;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
int height[N][N];

class State{
public:
  int y, x, cost;
};

int bfs(){
  State u, v;
  u.y = 0;
  u.x = 0;
  u.cost = 0;
  queue<State> Q;
  Q.push(u);
  fill(height[0], height[N], INF);
  height[0][0] = 0;
  while(!Q.empty()){
    u = Q.front(); Q.pop();
    for(int i=0;i<4;i++){
      v.y = u.y + dy[i];
      v.x = u.x + dx[i];
      if(v.y < 0 || v.y > h+1) continue;
      if(v.x < 0 || v.x > w+1) continue;
      v.cost = u.cost;
      if(mapData[v.y][v.x] == '#') ++v.cost;
      if(height[v.y][v.x] <= v.cost) continue;
      height[v.y][v.x] = v.cost;
      Q.push(v);
    }
  }
  return height[gy][gx];
}

main(){
  while(cin >> w >> h && (h || w)){
    int i = 0, j;
    for(j=0;j<=w+1;j++){
      mapData[i][j] = '.';
    }
    for(i=1;i<=h;i++){
      for(j=0;;j++){
	if(j == 0){
	  mapData[i][j] = '.';
	  continue;
	}
	if(j == w + 1){
	  mapData[i][j] = '.';
	  break;
	}
	cin >> mapData[i][j];
	if(mapData[i][j] == '&'){
	  mapData[i][j] = '.';
	  gy = i;
	  gx = j;
	}
      }
    }
    for(j=0;j<=w+1;j++){
      mapData[i][j] = '.';
    }
    cout << bfs() << endl;
  }
  return 0;
}