#include <bits/stdc++.h>
using namespace std;

int main() {
    int64_t n, m, k = 0, ans = 0;
    cin >> n >> m;
    vector<int64_t> a(m + 1, 0);
    map<int64_t, int> s;
    for (auto i = 0; i < m; i++) cin >> a[i];
    a.push_back(n + 1);
    sort(a.begin(), a.end());
    for (auto i = 0; i < (int)a.size() - 1; i++)
        if (a[i + 1] != a[i]) s[a[i + 1] - a[i] - 1]++;
    for (auto& elm : s) {
        if (elm.first == 0) continue;
        if (k == 0) k = elm.first, ans += elm.second;
        else
            ans += (elm.first / k +
                    ((elm.first % k) ? 1 : 0)) *
                   elm.second;
    }
    cout << ans << endl;
    return 0;
}
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int p(int A,int B){
  if(!B)return 1;
  if(B&1)return p(A,B-1)*A%mod;
  int C=p(A,B/2);
  return C*C%mod;
}
signed main(){
  int H,W,cnt=0,ans=0;
  cin>>H>>W;
  vector<string> A(H);
  for(string &S:A)cin>>S;
  vector<vector<int>> B(H+1,vector<int>(W+1,-mod));
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      if(A[i][j]=='.')B[i][j]=1,cnt++;
  vector<vector<int>> C=B;
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++){
      B[i][j+1]+=max(B[i][j],0LL);
      C[i+1][j]+=max(C[i][j],0LL);
    }
  vector<vector<int>> D(H,vector<int>(W,-1));
  for(int i=H-1;i>=0;i--)
    for(int j=W-1;j>=0;j--){
      if(B[i][j]>=0 && B[i][j+1]>=0)B[i][j]=B[i][j+1];
      if(C[i][j]>=0 && C[i+1][j]>=0)C[i][j]=C[i+1][j];
      if(B[i][j]>=0)D[i][j]+=B[i][j];
      if(C[i][j]>=0)D[i][j]+=C[i][j];
    }
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      if(D[i][j]>0)ans=(ans+p(2,cnt-D[i][j])*((p(2,D[i][j])-1+mod)%mod)%mod)%mod;
  cout<<ans<<endl;
}