#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> State;
const int INF = 1e+9;
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};

void debug(const vector<string>& m){
	for(int y=0 ; y < m.size() ; y++ )
		cout << m[y] << endl;
}

// Æ³
int w, h;
// d[y][x] Í(y,x)ÌÅ¬RXg, Ü¾mèµÄ¢È¢Æ«ÍINF
int d[110][110];
// used[p] ÍP p=(x,y)ªTõÏÝ©Ç¤©
map<P,bool> used;
// n ÍÀWÌ(=w*h)
int n;
// S[ÌÊu
int gx, gy;

void debug2(){
	cout << "d:" << endl;
	for(int y = 0 ; y < h ; y++ ){
		for(int x = 0 ; x < w ; x++ ){
			if( d[y][x] == INF ){
				cout << '?';
			}else if( d[y][x] >= 0 && d[y][x] <= 9 ){
				cout << d[y][x];
			}else{
				cout << 9;
			}
		}
		cout << endl;
	}
}

// S[ÌÊuð²×é
void search_goal(vector<string>& m){
	for(int y = 0 ; y < h ; y++ ){
		for(int x = 0 ; x < w ; x++ ){
			if( m[y][x] == '&' ){
				m[y][x] = '.';
				gx = x;
				gy = y;
			}
		}
	}
}

void solve(vector<string>& m){
	// ú»
	w += 2;
	h += 2;
	n = w * h;
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			d[y][x] = INF;
			used[P(x,y)] = false;
		}
	}
	// S[ÌÊuð²×é
	search_goal( m );
	
	// (x,y)=(0,0) ðn_ÆµÄTõ·é
	P sp(0,0);
	d[0][0] = 0;
	used[sp] = true;
	// State s; ÉÂ¢Ä s.first ÍRXg, s.second ÍÀW(pair<int,int>)
	State ini( 0 , sp );
	priority_queue< State , vector<State> , greater<State> > q;
	q.push( ini );
	
	while( !q.empty() ){
		// RXgÌ¬³¢ÀW©çÉoÄ­é
		int cost = q.top().first;
		P p = q.top().second;
		q.pop();
		// ÀW p ðmèm[hÉ·é
		used[p] = true;
		
		for(int i=0 ; i < 4 ; i++ ){
			int mx = p.first + dx[i];
			int my = p.second + dy[i];
			P next_p(mx,my);
			
			if( mx < 0 || my < 0 || mx >= w || my >= h || used[next_p] == true ) continue;
			
			int next_cost;
			if( m[my][mx] == '#' ){
				d[my][mx] = min( d[my][mx] , cost + 1 );
				next_cost = cost + 1;
			}else if( m[my][mx] == '.' ){
				d[my][mx] = min( d[my][mx] , cost );
				next_cost = cost;
			}
			State next( next_cost , next_p );
			q.push( next );
		}
	}
}

int main(){
	while( cin >> w >> h , w || h ){
		vector<string> m(h+2);
		string t;
		for(int i=0 ; i < w+2 ; i++ )
			t.push_back('.');
		m[0] = m[h+1] = t;
		
		for(int y = 1 ; y <= h ; y++ ){
			string s, s_;
			cin >> s;
			s_ = "." + s + ".";
			m[y] = s_;
		}
		//debug( m );
		solve( m );
		//debug2();
		int ans = d[gy][gx];
		cout << ans << endl;
	}
}