#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int quickpower(int a,int b){
	int ans=1;
	a%=mod;
	while(b){
		if(b&1) ans=(ans*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ans%mod;
}
int C(int n,int m){
	if(n<m) return 0;
	if(m*2>n)  m=n-m;
	if(m==0) return 1;	
	int up=1,down=1;	
	for(int i=1;i<=m;i++){
		up=(up*(n-i+1))%mod;		
		down=(down*i)%mod;	
	}	
	return up*quickpower(down,mod-2)%mod;
}
signed main(){
	int n,m,s=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		int k;
		cin>>k;
		s+=k;
	}
	cout<<C(m+n,s+n);
	return 0;
}
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
int M;
int L[200000];
int R[200000];
int main(){
  int i;
  int fg = 0;
  rd(N);
  rd(M);
  if(M==0){
    int i;
    for(i=(0);i<(N);i++){
      wt_L(2*i+1);
      wt_L(' ');
      wt_L(2*i+2);
      wt_L('\n');
    }
    return 0;
  }
  if(M < 0){
    fg = 1;
    M *= -1;
  }
  if(M > N-2 || fg==1){
    wt_L(-1);
    wt_L('\n');
    return 0;
  }
  for(i=(0);i<(N);i++){
    {
      auto cTE1_r3A = (200000000+2*i);
      auto RZTsC2BF = ( 200000000+2*i+1);
      L[i] = cTE1_r3A;
      R[i] = RZTsC2BF;
    }
  }
  {
    auto FmcKpFmN = (1);
    auto xr20shxY = ( 100000000);
    L[0] = FmcKpFmN;
    R[0] = xr20shxY;
  }
  {
    auto WYIGIcGE = (2);
    auto t_ynMSdg = ( 3);
    L[1] = WYIGIcGE;
    R[1] = t_ynMSdg;
  }
  for(i=(0);i<(M);i++){
    {
      auto tU__gIr_ = (10+2*i);
      auto a2conNHc = ( 10+2*i+1);
      L[2+i] = tU__gIr_;
      R[2+i] = a2conNHc;
    }
  }
  for(i=(0);i<(N);i++){
    wt_L(L[i]);
    wt_L(' ');
    wt_L(R[i]);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20201115-2

// --- original code ---
// int N, M, L[2d5], R[2d5];
// {
//   int fg = 0;
//   rd(N,M);
// 
//   if(M==0){
//     rep(i,N) wt(2*i+1, 2*i+2);
//     return 0;
//   }
// 
//   if(M < 0) fg = 1, M *= -1;
//   if(M > N-2 || fg==1) wt(-1), return 0;
// 
//   rep(i,N) (L[i], R[i]) = (2d8+2*i, 2d8+2*i+1);
//   (L[0], R[0]) = (1, 1d8);
//   (L[1], R[1]) = (2, 3);
//   rep(i,M) (L[2+i], R[2+i]) = (10+2*i, 10+2*i+1);
// 
//   rep(i,N) wt(L[i], R[i]);
// }
