#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;
const ll mod=99824453;
vin dx={-1,0,1,0};
vin dy={0,1,0,-1};

ll modpow(ll a,ll n,ll m=inf){
    ll res=1;
    while(n){
        if(n&1)res=res*a%m;
        a=a*a%m;
        n>>=1;
    }
    return res;
}

int main(){
    ll h,w;cin>>h>>w;
    vstr s(h);rep(i,h)cin>>s[i];
    vvin up(h,vin(w)),down(h,vin(w)),right(h,vin(w)),left(h,vin(w));
    int tmp=-1;ll k=h*w;
    rep(i,h){
        tmp=-1;
        rep(j,w){
            left[i][j]=tmp;
            if(s[i][j]=='#'){
                tmp=j;
                k--;
            }
        }
        tmp=w;
        for(int j=w-1;j>=0;j--){
            right[i][j]=tmp;
            if(s[i][j]=='#')tmp=j;
        }
    }
    rep(j,w){
        tmp=-1;
        rep(i,h){
            up[i][j]=tmp;
            if(s[i][j]=='#')tmp=i;
        }
        tmp=h;
        for(int i=h-1;i>=0;i--){
            down[i][j]=tmp;
            if(s[i][j]=='#')tmp=i;
        }
    }
    ll all=modpow((ll)2,k),light,can;
    ll ans=(ll)0;
    rep(i,h)rep(j,w){
        if(s[i][j]=='.'){
            light=(down[i][j]-up[i][j]-(ll)1)+(right[i][j]-left[i][j]-(ll)1)-(ll)1;
            can=all-modpow((ll)2,k-light);
            if(can<0)can+=inf;
            ans+=can;ans%=inf;
        }
    }
    cout<<ans<<endl;
}
#include<bits/stdc++.h>
using namespace std;

#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define float           double
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vc              vector<char>
#define vb              vector<bool>
#define vf              vector<float>
#define vs              vector<string>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define hashmap         unordered_map
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT64_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)          x.begin(),x.end()
#define digits(x)       floor(log10(x))+1
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

template<class T>
void printV(vector<T> a) {for (auto v : a)cout << v << " ";}
template<class T>
void readV(vector<T>& a) {int n = a.size(); for (int i = 0 ; i < n ; i++)cin >> a[i];}
template<class T>
void printA(T* a , int n) {for (int i = 0; i < n  ; i++)cout << a[i] << " ";}
template<class T>
void readA(T* a , int n) {for (int i = 0 ; i < n ; i++)cin >> a[i];}
auto clk = clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
void run_time() {cerr << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;}

void aryan_pandeya() {
#ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
#endif
}


void solve() {
    int n , m ;
    cin >> n >> m;

    if (m == 0) {
        cout << 1;
        return;
    }
    vi a(m);
    for (int i = 0 ; i < m ; i++) {
        cin >> a[i];
    }
    sort(all(a));
    vi gaps;
    if (a[0] - 1 != 0) {
        gaps.pb(a[0] - 1);
    }
    for (int i = 1 ; i < m ; i++) {
        if (a[i] - a[i - 1] - 1 != 0) {
            gaps.pb(a[i] - a[i - 1] - 1);
        }
    }
    if (n - a[m - 1] != 0) {
        gaps.pb(n - a[m - 1]);
    }
    if (gaps.size() == 0) {
        cout << 0;
        return;
    }
    // printV(gaps);
    // cout << '\n';
    int val = *min_element(all(gaps));
    int ans = 0;
    for (auto v : gaps) {
        ans += (ceil((v * 1.0) / val));
    }
    cout << ans;
}


int32_t main() {
    aryan_pandeya();
    FIO;

    solve();
    run_time();




    return 0;
}
