#include <bits/stdc++.h>
/* #include <atcoder/all> */

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;
/* using namespace atcoder; */

using ll = long long;
using P = pair<int, int>;

const int MOD = 1'000'000'007;

template<class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) {
    cin >> s.at(i);
  }
  vector<vector<ll>> r(h, vector<ll>(w));
  vector<vector<ll>> d(h, vector<ll>(w));
  vector<vector<ll>> rd(h, vector<ll>(w));
  vector<vector<ll>> dp(h, vector<ll>(w, 0));
  dp.at(0).at(0) = 1;
  rep(i, h) {
    rep(j, w) {
      if (s.at(i).at(j) == '#') {
        r.at(i).at(j) = 0;
        d.at(i).at(j) = 0;
        rd.at(i).at(j) = 0;
        continue;
      }
      // r
      int oi = i - 1;
      int oj = j;
      if (oi < h && oj < w && oi >= 0 && oj >= 0) {
        r.at(i).at(j) += dp.at(oi).at(oj);
        r.at(i).at(j) += r.at(oi).at(oj);
      }
      // d
      oi = i;
      oj = j - 1;
      if (oi < h && oj < w && oi >= 0 && oj >= 0) {
        d.at(i).at(j) += dp.at(oi).at(oj);
        d.at(i).at(j) += d.at(oi).at(oj);
      }
      // rd
      oi = i - 1;
      oj = j - 1;
      if (oi < h && oj < w && oi >= 0 && oj >= 0) {
        rd.at(i).at(j) += dp.at(oi).at(oj);
        rd.at(i).at(j) += rd.at(oi).at(oj);
      }
      dp.at(i).at(j) += r.at(i).at(j);
      dp.at(i).at(j) %= MOD;
      dp.at(i).at(j) += d.at(i).at(j);
      dp.at(i).at(j) %= MOD;
      dp.at(i).at(j) += rd.at(i).at(j);
      dp.at(i).at(j) %= MOD;
    }
  }
  cout << dp.at(h - 1).at(w - 1) << endl;
  return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define autoitr(x,it) for(auto it = x.rbegin(); it != x.rend(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
  FAST/**/
   
   ll n,m;
   cin>>n>>m;
   
   if(n == 1)
   {
       if(m == 0)
       {
           cout<<1<<" "<<2<<"\n";
           return 0;
       }
       cout<<-1<<"\n";
       return 0;
   }
   
   if(m<0 || m >= n-1)
   {
       cout<<-1<<"\n";
       return 0;
   }
   
   if(m == 0)
   {
       rep(n)
            cout<<(2*i+1)<<" "<<(2*i+2)<<"\n";
       return 0;        
   }
   
   if(m == n-1)
   {
       for(ll i=1;i<=n-1;i++)
           cout<<2*i<<" "<<2*i+1<<"\n";
       cout<<1<<" "<<2*n<<"\n";
       return 0;
   }
   
   ll sta = 2;
   for(ll i=0;i<m+1;i++)
   {
       cout<<sta<<" "<<sta+1<<"\n";
       sta+=2;
   }
   
   cout<<1<<" "<<sta<<"\n";
   sta++;
   rep(n-(m+2))
   {
       cout<<sta<<" "<<sta+1<<"\n";
       sta+=2;
   }
   
  return 0;   
  
}  
