#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;

using lint = long long;

vector<int> di = {-1, 0, 1, 0};
vector<int> dj = {0, 1, 0, -1};

template <class T>
struct Edge {
    int from, to;
    T cost;
    int idx;
    
    Edge() {}
    Edge(int to_) : to(to_) {}
    Edge(int to_, T cost_) : to(to_), cost(cost_) {}
    Edge(int from_, int to_, int idx_) : from(from_), to(to_), idx(idx_) {}
    Edge(int from_, int to_, T cost_, int idx_) : from(from_), to(to_), cost(cost_), idx(idx_) {}
};

template <class T> using Graph = vector<vector<Edge<T>>>;
using graph = Graph<long long>;
using edge = Edge<long long>;

#define add emplace_back

struct Dijkstra {
    private:
    graph g;
    int n, s;
    vector<long long> d;
    vector<edge> prev;
    vector<bool> visit;
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> pq;
    
    public:
    Dijkstra(graph g_, int s_) : g(g_), n(g.size()), s(s_), d(n, 1000000000000000000), prev(n), visit(n, false) {
        d[s] = 0LL;
        pq.emplace(d[s], s);
        while (!pq.empty()) {
            int v = pq.top().second;
            pq.pop();
            if (visit[v]) {
                continue;
            }
            visit[v] = true;
            for (auto e : g[v]) {
                int nv = e.to;
                long long nc = e.cost;
                if (d[nv] > d[v] + nc) {
                    d[nv] = d[v] + nc;
                    prev[nv] = e;
                    pq.emplace(d[nv], nv);
                }
            }
        }
    }
    
    vector<long long> dists() {
        return d;
    }
    
    long long dist(int t) {
        return d[t];
    }
    
    vector<edge> route(int t) {
        if (s == t || d[t] == 1000000000000000000) {
            return {};
        }
        vector<edge> res;
        int cur = t;
        while (cur != s) {
            res.emplace_back(prev[cur]);
            cur = prev[cur].from;
        }
        reverse(res.begin(), res.end());
        return res;
    }
};

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> s(h, vector<char>(w));
    rep(i, h) rep(j, w) {
        cin >> s[i][j];
    }
    auto inc = [&](int i, int j) {
        return (0 <= i && i < h && 0 <= j && j < w);
    };
    graph g(h * w);
    rep(i, h) rep(j, w) rep(k, 4) {
        int ni = i + di[k], nj = j + dj[k];
        if (!inc(ni, nj) || s[ni][nj] == '#') {
            continue;
        }
        if (k % 2 == 0) {
            g[w * i + j].add(w * ni + nj, 1LL);
        } else {
            g[w * i + j].add(w * ni + nj, 1000000LL);
        }
    }
    lint ans = Dijkstra(g, 0).dist(w * (h - 1) + w - 1);
    if (ans == 1000000000000000000) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
        cout << ans / 1000000LL << " " << ans % 1000000LL << endl;
    }
}