#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long MOD = 1e9 + 7;
double EPS = 1e-3;
const double PI = acos(-1);
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
double h, w;
char C[210][210];
int d[210][210];
bool isOutOfRange(int x, int y) {
  if (x <= 0 || x > w || y <= 0 || y > h) return true;
  return false;
}
int main() {
  pair<int, int> p;
  int x, y, nx, ny, c, nc;
  int gx, gy;
  while (cin >> w >> h && h && w) {
    for (int i = (0); i < (int)(h); i++) scanf("%s", C[i]);
    for (int i = (0); i < (int)(h); i++)
      for (int j = (0); j < (int)(w); j++)
        if (C[i][j] == '&') gx = j, gy = i;
    gx++;
    gy++;
    for (int i = (0); i < (int)(210); i++)
      for (int j = (0); j < (int)(210); j++) d[i][j] = -1;
    priority_queue<pair<int, int> > q;
    for (int i = (0); i < (int)(h); i++)
      q.push(make_pair(0, (i + 1) * 1000)),
          q.push(make_pair(0, (i + 1) * 1000 + w + 1));
    for (int i = (0); i < (int)(w); i++)
      q.push(make_pair(0, i + 1)), q.push(make_pair(0, (h + 1) * 1000 + i + 1));
    while (!q.empty()) {
      p = q.top();
      q.pop();
      y = p.second / 1000;
      x = p.second % 1000;
      c = p.first;
      for (int i = (0); i < (int)(4); i++) {
        nx = x + dx[i];
        ny = y + dy[i];
        if (isOutOfRange(nx, ny)) continue;
        nc = c + (C[ny - 1][nx - 1] == '#' ? 1 : 0);
        if (d[ny][nx] != -1 && d[ny][nx] <= nc) continue;
        d[ny][nx] = nc;
        if (ny == gy && nx == gx) break;
        q.push(make_pair(nc, ny * 1000 + nx));
      }
    }
    cout << d[gy][gx] << endl;
  }
}
