#include <bits/stdc++.h>
using namespace std;
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;
int d[110][110];
map<pair<int, int>, bool> used;
int n;
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;
  }
}
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[pair<int, int>(x, y)] = false;
    }
  }
  search_goal(m);
  pair<int, int> sp(0, 0);
  d[0][0] = 0;
  used[sp] = true;
  pair<int, pair<int, int> > ini(0, sp);
  priority_queue<pair<int, pair<int, int> >,
                 vector<pair<int, pair<int, int> > >,
                 greater<pair<int, pair<int, int> > > >
      q;
  q.push(ini);
  while (!q.empty()) {
    int cost = q.top().first;
    pair<int, int> p = q.top().second;
    q.pop();
    used[p] = true;
    for (int i = 0; i < 4; i++) {
      int mx = p.first + dx[i];
      int my = p.second + dy[i];
      pair<int, int> 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;
      }
      pair<int, pair<int, int> > 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_;
    }
    solve(m);
    int ans = d[gy][gx];
    cout << ans << endl;
  }
}
