stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

#define mod 998244353

typedef long long ll;



using namespace std;



void Fastio(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

    if (exp == 0)

        return 1;

    ll ans = fp(base, exp / 2);

    ans = (ans * ans) % mod;

    if (exp % 2 != 0)

        ans = (ans * (base % mod)) % mod;

    return ans;

}



void calcFacAndInv(ll n)

{

    fact[0] = inv[0] = 1;

    for (ll i = 1; i <= n; i++)

    {

        fact[i] = (i * fact[i - 1]) ;

        inv[i] = fp(fact[i], mod - 2);

    }

}



ll ncr(ll n, ll r)

{

    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;

}



ll npr(ll n, ll r)

{

    return (fact[n] * inv[n - r]) % mod;

}



long double  NCR(int n, int m){

    long double res = 1;

    m = min(m, n - m);

    for(int i = 0; i < m; i++){

        res = res * ( n - i) / (i + 1);

 }

    return res;

}

ll tol(string a){

    ll res=0;

    while(a[0]=='0'){

        a.erase(a.begin());

    }

    if(a=="")a="0";

    for(int i=0; i<a.size(); i++){

        res*=10; res+=a[i]-'0';

    }

    return res;

}

int check(string a, string b){

    for(int i=0; i<a.size(); i++){

        if(a[i]>b[i])return 1;

        if(b[i]>a[i])return -1;

    }

    return 0;

}

class data{

public:

    ll v,d,p;

    data(){}

    data(ll vv, ll dd, ll pp){

        v=vv;  d=dd; p=pp;

    }

};



int primeFactors(int n)

{

    ll c=0;

    while (n % 2 == 0)

    {

        c++;

        n = n/2;

    }

    for (int i = 3; i*i <= n; i = i + 2)

    {

        while (n % i == 0)

        {

            c++;

            n = n/i;

        }

    }

    if (n > 2)

        c++;

    return c;

}

int n,m, counter;

vector<int>arr[200005];

int vis[200005];

void dfs(int node){

    vis[node]=1; counter++;

    for(int i=0; i<arr[node].size(); i++){

        if(!vis[arr[node][i]])dfs(arr[node][i]);

    }

}

int main()

{

    Fastio();

    double n,k,pos=0; cin>>n>>k; k--;

    for(int i=0; i<n; i++){

        int x; cin>>x;

        if(x==1)pos=i;

    }

    ll tmp1, tmp2;

    int p=pos,kk=k;

    while(p%kk && p+1<n)p++;

    pos=p; tmp1=ceil(pos/k);

    tmp2=ceil((n-pos-1)/k);

    ll res=tmp1+tmp2;

    cout<<res<<'\n';



    return 0;

}




// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using namespace std;



#ifdef ZERO_IQ

ios_base::sync_with_stdio ( false ), cin.tie ( 0 ), cout.tie ( 0 );

#endif



int main() {

    int n, m;

    cin >> n >> m;

    cout << 1LL * ((n - 1) + (m - 2)) / (m - 1) << endl;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{

    int n, k, a[100010] = {};

    cin >> n >> k;

    for (int i = 0; i < n; i++) cin >> a[i];



    cout << (n - 1 + k - 2) / (k - 1) << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main()

{

    int n, k;

    cin >> n >> k;



    cout << (n - 1 + k - 2) / (k - 1) << endl;



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// ABC101C - Minimization



#include <bits/stdc++.h>

using namespace std;



int main() {

	int N, K;

	cin >> N >> K;

	for (int i = 0; i < N; i++) {

		int t;

		cin >> t;

	}



	int ans;

	ans = ((N - K) + (K - 2))/ (K - 1) + 1;



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
// ABC101C - Minimization



#include <cstdio>



int main() {

	int N, K;

	scanf("%d%d", &N, &K);



	printf("%d\n", (N - 2)/(K - 1) + 1);



	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// ABC101C - Minimization



#include <bits/stdc++.h>

using namespace std;



int main() {

	int N, K;

	cin >> N >> K;

	for (int i = 0; i < N; i++) {

		int t;

		cin >> t;

	}



	int ans;

//	ans = ((N - K) + (K - 2))/ (K - 1) + 1;

	ans = (N - 2)/(K - 1) + 1;



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
// ABC101C - Minimization



#include <cstdio>



int main() {

	int N, K;

	scanf("%d%d", &N, &K);



	printf("%d\n", (N - 2)/(K - 1) + 1);



	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// ABC101C - Minimization



#include <bits/stdc++.h>

using namespace std;



int main() {

	int N, K;

	cin >> N >> K;

//	for (int i = 0; i < N; i++) {

//		int t;

//		cin >> t;

//	}



	int ans;

//	ans = ((N - K) + (K - 2))/ (K - 1) + 1;

	ans = (N - 2)/(K - 1) + 1;



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
// ABC101C - Minimization



#include <cstdio>



int main() {

	int N, K;

	scanf("%d%d", &N, &K);



	printf("%d\n", (N - 2)/(K - 1) + 1);



	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// ABC101C - Minimization



#include <bits/stdc++.h>

using namespace std;



int main() {

	int N, K;

	cin >> N >> K;

	vector<int> A(N);

	for (int i = 0; i < N; i++) {

		cin >> A.at(i);

	}



	int ans;

	ans = ((N - K) + (K - 2))/ (K - 1) + 1;



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
// ABC101C - Minimization



#include <cstdio>



int main() {

	int N, K;

	scanf("%d%d", &N, &K);



	printf("%d\n", (N - 2)/(K - 1) + 1);



	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<string>

using namespace std;

int main()

{

	int k, n;

	cin >> n >> k;

	int tmp;

	for (int i = 0; i < n; i++)cin >> tmp;

	tmp = 0;

	for (int i = 0; i < n - 1; i += k - 1)

		tmp++;

	cout << tmp << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define pi 2*acos(0.0)

int main(){

      int a,b;

      cin>>a>>b;

      vector<int>vec;

      for(int i=0;i<a;i++){

        int x;

        cin>>x;

        vec.push_back(x);

      }

      sort(vec.begin(),vec.end());

        int c=0,flag=0;

      for(int i=0;i<a;i+=b-1){

            for(int j=i;j<i+b&&j<a;j++){

                if(vec[j]==vec[0])continue;

                else{

                    vec[j]=vec[0];

                    flag=1;

                }

            }

            if(flag==1){

                c++;

                flag=0;

            }



      }

      cout<<c<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std ;



int main(){

   ios_base::sync_with_stdio(0);

   cin.tie(0);

   cout.tie(0);



   int n, k, v ;

   cin >> n >> k ;

   for(int i = 0 ; i < n ; i++){

     cin >> v ;

   }



   int cn = 0 ;

   for(int i = 1 ; i < n ; i += k - 1){

        cn++ ;

   }



   cout << cn;



}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int N = 110000;



int main() {

	

	ios::sync_with_stdio(0);

	cin.tie(0), cout.tie(0);

	

	int n, K; cin >> n >> K;

	cout << (n - 2) / (K - 1) + 1 << "\n";

	

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define vl vector<ll>

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mod 1000000007

#define inf 1000000000000000

#define md 998244353

#define endl "\n"



void solve()

{

    int n,k,ind;

    cin>>n>>k;

    

    int a[n];

    

    for(int i=0;i<n;i++)

    {

      cin>>a[i];

      if(a[i]==1)

      ind=i;

    } 

    

    if((n-1)%(k-1)==0)

    cout<<(n-1)/(k-1)<<endl;

    else

    cout<<(n-1)/(k-1)+1<<endl;

}



int main()

{

	

	solve();

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ull unsigned long long

#define ll long long

#define db double

#define ldb long double

#define vi vector<int>

#define vull vector<ull>

#define vll vector<ll>

#define pb push_back

#define rep(i,n) for(int i=0;i<n;i++)

#define repr(i,n) for(int i=n-1;i>=0;i--)

#define si set<int>

#define sll set<ll>

#define ins insert

#define vpp vector<pair<int,int>>

#define mp make_pair

#define ft first

#define sc second

using namespace std;



int main(){

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	cout.tie(0);

    int n,k;

    cin>>n>>k;

    int a[n];

    int p=-1;

    rep(i,n){

    	cin>>a[i];

	}

    int r=0;

    if((n-1)%(k-1) !=0)

    r=1;

    int ans=ceil((n-1)/(k-1))+r;

    cout<<ans;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

using namespace std;



int MinIndex(vector <int> A){

  int i = 0;

  int m = 1;

  for (int j = 0; j < A.size(); j++){

    if (A[j] < m)

      m = A[j];

      i = j;

  }

  return i;

}



int HowMany(vector <int> A, int K, int N){

  if (N == K)

    return 1;

  int i = 0;

  int x = N - MinIndex(A), y = MinIndex(A);

  while (x > 0){

    i++;

    x -= K;

    x++;

  }

  while (y > 0){

    i++;

    y -= K;

    y++;

  }

  return i-1;

}



int main() {

  ios_base::sync_with_stdio(false);



  int N, K;

  cin >> N >> K;

  vector <int> A(N);

  for (int i = 0; i < N; i++)

    cin >> A[i];

  cout << HowMany(A, K, N) << endl;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n,k,sum=0;

	scanf("%d%d",&n,&k);

	while(1)

	{

		n-=k;

		sum++;

		if(n<=0)break;

		n++;

	}

	printf("%d\n",sum);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() {

  int N, K; cin >> N >> K;

  int A[100000]; for (int i = 0; i < N; i++) cin >> A[i];

  cout << (N + K - 3) / (K - 1) << endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;



int main() {

  int N, K; scanf("%d %d", &N, &K);

  int A[100000]; for (int i = 0; i < N; i++) scanf("%d", &A[i]);

  printf("%d\n", (N + K - 3) / (K - 1));

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cmath>

#include <ctime>

#include <cstdio>

#include <cctype>

#include <cstdlib>

#include <cstring>

#include <iostream>

#include <sstream>

#include <algorithm>

#include <set>

#include <stack>

#include <queue>

#include <string>

#include <vector>

#include <map>

#define maxn 110

#define maxl 1000000000

#define mod 1000000007

using namespace std;



typedef unsigned long long ull;



int a[maxn];

double ans[maxn];



bool solve(){

	int n,i,j,r,k;

	double b,v,e,f,temp2,temp;

	scanf("%d",&n);

	if(n==0)return false;

	for(i=1;i<=n;++i){

		scanf("%d",&a[i]);

		ans[i]=1e30;

	}

	scanf("%lf%d%lf%lf%lf",&b,&r,&v,&e,&f);

	ans[0]=-b;

	for(i=0;i<n;++i){

		temp=ans[i]+b;

		for(j=i+1;j<=n;++j){

			for(k=a[j-1];k<a[j];++k){

				if(k-a[i]>=r)temp2=1/(v-e*(k-a[i]-r));

				else temp2=1/(v-f*(r-(k-a[i])));

				temp+=temp2;

			}

			ans[j]=min(temp,ans[j]);

		}

	}

	printf("%.4f\n",ans[n]);

	return true;

}



int main(){

	while(solve());

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>

#define MAXN 10010

double v,e,f,b;

int dis[MAXN];

double dp[MAXN],time[MAXN];

int r,n;

void calc()

{

    int i;

    memset(time,0,sizeof time);

    for (i = 0; i <= dis[n]+1; i++)

    {

        double tmp;

        if (i >= r) tmp = 1.0 / (v - e * (i - r));

        else tmp = 1.0 / (v - f * (r - i));

        time[i+1] = time[i] + tmp;

    }

}



int main() {

    while (scanf("%d", &n) && n)

    {

        memset(dp,0,sizeof dp);

        memset(dis,0,sizeof dis);

        for (int i = 1; i <= n; i++)

            scanf("%d", &dis[i]);

        scanf("%lf",&b);

        scanf("%d%lf%lf%lf",&r,&v,&e,&f);

        calc();

        double min;



        for(int i = 1; i <= n; i++)

        {

            double tmp;

            min = 10000000000;

            for(int j = 0; j < i; j++)

                if ((tmp = dp[j] + time[dis[i] - dis[j]]) < min)

                    min = tmp;

            dp[i] = min + b;

        }

        printf("%.4lf\n", dp[n] - b);

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<algorithm>



#define	rep(i,n)	for(int i=0;i<n;i++)



using namespace std;



int main(){

	for(int n;scanf("%d",&n),n;){

		int a[101]={},r;

		rep(i,n)	scanf("%d",a+i+1);

		double b,v,e,f;	scanf("%lf%d%lf%lf%lf",&b,&r,&v,&e,&f);

		n++;



		static double t[10001];

		rep(x,a[n-1]){

			if(x<r)	t[x+1]=t[x]+1/(v-f*(r-x));

			else	t[x+1]=t[x]+1/(v-e*(x-r));

		}



		static double dp[101][10001];

		rep(i,n)rep(x,a[n-1]+1)	dp[i][x]=1e60;

		dp[0][0]=0;

		for(int i=1;i<n;i++){

			int dis=a[i]-a[i-1];

			for(int x=dis;x<=a[n-1];x++){

				dp[i][x]=min(dp[i][x],dp[i-1][x-dis]+t[x]-t[x-dis]);

				dp[i][0]=min(dp[i][0],dp[i][x]+b);

			}

		}



		printf("%.9f\n",*min_element(dp[n-1],dp[n-1]+a[n-1]+1));

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>



#define	rep(i,n)	for(int i=0;i<n;i++)



using namespace std;



int main(){

	for(int n;scanf("%d",&n),n;){

		int a[101]={},r;

		rep(i,n)	scanf("%d",a+i+1);

		double b,v,e,f;	scanf("%lf%d%lf%lf%lf",&b,&r,&v,&e,&f);

		n++;



		static double t[10001];

		rep(x,a[n-1]){

			if(x<r)	t[x+1]=t[x]+1/(v-f*(r-x));

			else	t[x+1]=t[x]+1/(v-e*(x-r));

		}



		static double dp[101][101];

		rep(i,n)rep(j,n)	dp[i][j]=1e60;

		dp[0][0]=0;

		for(int i=1;i<n;i++){

			rep(j,i){

				int dis=a[i]-a[j];

				dp[i][j]=min(dp[i][j],dp[j][j]+t[dis]);

				dp[i][i]=min(dp[i][i],dp[i][j]+b);

			}

		}



		printf("%.9f\n",*min_element(dp[n-1],dp[n-1]+n));

	}



	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define mod 1000000007

#define maxn 100005

using namespace std;



int fac[maxn], n, m, sn, ifac[maxn], inv[maxn], f[21][maxn], ans, a[21], digit[maxn];

int C(int u, int v){

    if(u < v) return 0;

    return 1ll * fac[u] * ifac[v] % mod * ifac[u - v] % mod; 

}

int main()

{

    //freopen(".in","r",stdin);

    //freopen(".out","w",stdout);

    cin >> n; cin >> m; sn = 1 << n;

    fac[0] = 1; inv[0] = 1; ifac[0] = 1;

    for(int i = 1; i <= sn; i++) {

        fac[i] = 1ll * fac[i - 1] * i % mod;

        inv[i] = (i == 1) ? 1 : 1ll * inv[mod % i] * (mod - mod / i) % mod;

        ifac[i] = 1ll * ifac[i - 1] * inv[i] % mod; 

    }

    for(int i = 1; i <= m; i++) cin >> a[i];

    sort(a + 1, a + m + 1);

    f[m + 1][0] = 1;

    for(int i = m; i >= 1; i--)

        for(int j = 0; j < sn; j++){

            (f[i][j] += f[i + 1][j]) %= mod;

            for(int k = 0; k < n; k++){

                if(j & (1 << k)) continue;

                int p = sn - j - a[i];

                (f[i][j + (1 << k)] += 1ll * f[i + 1][j] * C(p, (1 << k) - 1) % mod * fac[1 << k] % mod) %= mod;

            }

        }

    for(int i = 0; i < sn; i++) {

        digit[i] = digit[i >> 1] + (i & 1);

        f[1][i] = 1ll * f[1][i] * fac[sn - i - 1] % mod;

        if(digit[i] % 2 == 0) ans = (ans + f[1][i]) % mod;

        else ans = (ans + mod - f[1][i]) % mod;

    }

    cout << 1ll * ans * sn % mod<< endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <algorithm>

#include <cstdio>



const int N=20,M=7e4+5,mod=1e9+7;

int n,m,lim,fac[M],inv[M],a[N],f[N][M],digit[M],ans;



inline int combn(int n,int m){

	if(n<m) return 0;

	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;

}



int main(){

	scanf("%d%d",&n,&m); lim=1<<n; fac[0]=inv[0]=inv[1]=1;

	for(int i=1;i<=m;++i) scanf("%d",&a[i]);

	for(int i=1;i<=lim;++i) fac[i]=1ll*fac[i-1]*i%mod;

	for(int i=2;i<=lim;++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

	for(int i=1;i<=lim;++i) inv[i]=1ll*inv[i-1]*inv[i]%mod;

	std::sort(a+1,a+1+m); f[m+1][0]=1;

	for(int i=m;i>=1;--i){

		for(int j=0;j<lim;++j){

			f[i][j]=(f[i][j]+f[i+1][j])%mod;

			for(int k=0;k<n;++k) if(!((j>>k)&1)){

				int tmp=1ll*combn(lim-j-a[i],(1<<k)-1)*fac[1<<k]%mod;

				f[i][j+(1<<k)]=(f[i][j+(1<<k)]+1ll*tmp*f[i+1][j])%mod;

			}

		}

	}

	for(int j=0;j<lim;++j){

		digit[j]=digit[j>>1]+(j&1);

		int tmp=1ll*fac[lim-1-j]*f[1][j]%mod;

		if(digit[j]&1) ans=(ans+mod-tmp)%mod;

		else ans=(ans+tmp)%mod;

	}

	printf("%d\n",1ll*ans*lim%mod);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<algorithm>

#include<cstring>

typedef long long ll;

using namespace std;

int n,m,i,a[18];

ll F[1<<17],inv[1<<17],f[1<<17],ans;

const int mod=1e9+7;

int C(int a,int b){return a<b?0:F[a]*inv[b]%mod*inv[a-b]%mod;}

void dec(ll &a,int b){(a-=b)<0?a+=mod:0;}

void inc(ll &a,int b){(a+=b)>=mod?a-=mod:0;}

int main(){

	scanf("%d%d",&n,&m);F[0]=F[1]=inv[0]=inv[1]=1;

	for(i=2;i<=(1<<n);i++)F[i]=F[i-1]*i%mod,inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

	for(i=2;i<=(1<<n);i++)inv[i]=inv[i]*inv[i-1]%mod;

	for(i=1;i<=m;i++)scanf("%d",&a[i]);

	for(f[0]=1<<n,i=m;i;i--)for(int j=(1<<n)-1;j;j--)for(int k=0;k<n;k++)if(j&(1<<k))dec(f[j],f[j^(1<<k)]*C((1<<n)-a[i]-(j^(1<<k)),(1<<k)-1)%mod*F[1<<k]%mod);

	for(i=0;i<(1<<n);i++)inc(ans,f[i]*F[(1<<n)-i-1]%mod);

	printf("%lld\n",ans);

}




// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <vector>

#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)



inline int read()

{

	int data = 0, w = 1; char ch = getchar();

	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();

	if (ch == '-') w = -1, ch = getchar();

	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();

	return data * w;

}



const int N(18), maxn(1 << 17), Mod(1e9 + 7);

inline void Add(int &x, int y) { x = (x + y) % Mod; }

int bin[N], fac[maxn], inv[maxn], n, m, ans, f[N][maxn], cnt[maxn], A[N];

inline int C(int n, int m) { return n < m ? 0 : 1ll * fac[n] * inv[m] % Mod * inv[n - m] % Mod; }

int fastpow(int x, int y)

{

	int ans = 1;

	for (; y; y >>= 1, x = 1ll * x * x % Mod)

		if (y & 1) ans = 1ll * ans * x % Mod;

	return ans;

}



int main()

{

	n = read(), m = read(), cnt[0] = bin[0] = fac[0] = inv[0] = 1;

	for (int i = 1; i <= n; i++) bin[i] = bin[i - 1] << 1;

	for (int i = 1; i <= bin[n]; i++) fac[i] = 1ll * fac[i - 1] * i % Mod;

	inv[bin[n]] = fastpow(fac[bin[n]], Mod - 2);

	for (int i = bin[n] - 1; i; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % Mod;

	for (int i = 1; i <= bin[n]; i++) cnt[i] = (i & 1) ? Mod - cnt[i >> 1] : cnt[i >> 1];

	for (int i = 1; i <= m; i++) A[i] = read(); std::sort(A + 1, A + m + 1);

	f[m + 1][0] = 1;

	for (int i = m; i; i--) for (int S = 0; S < bin[n]; S++) if (f[i + 1][S])

	{

		Add(f[i][S], f[i + 1][S]); int t = (bin[n] - 1) ^ S;

		for (int j = 0; j < n; j++) if (!(S & bin[j]))

			Add(f[i][S | bin[j]], 1ll * C(t - A[i] + 1, bin[j] - 1) *

					f[i + 1][S] % Mod * fac[bin[j]] % Mod);

	}

	for (int i = 0; i < bin[n]; i++)

		Add(ans, 1ll * f[1][i] * fac[bin[n] - 1 - i] % Mod * cnt[i] % Mod);

	ans = 1ll * ans * bin[n] % Mod; printf("%d\n", ans);

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

const int N=16;

const int MOD=1e9+7;

int n,m;

int a[N+1];

long long f[N+1][1<<N|1],fac[1<<N|1],inv[1<<N|1];

long long ksm(long long a,long long b)

{

	long long res=1;

	while(b)

	{

		if(b&1) res=res*a%MOD;

		a=a*a%MOD,b>>=1;

	}

	return res;

}

long long C(int n,int m)

{

    if(n<m) return 0;

    return fac[n]*inv[m]%MOD*inv[n-m]%MOD;

}

int main()

{

    scanf("%d%d",&n,&m);

    for(int i=1;i<=m;i++)

		scanf("%d",&a[i]);

    fac[0]=1;

    for(int i=1;i<=(1<<n);i++)

		fac[i]=fac[i-1]*i%MOD;

	inv[1<<n]=ksm(fac[1<<n],MOD-2);

    for(int i=1<<n;i>=1;i--)

    	inv[i-1]=inv[i]*i%MOD;

    sort(a+1,a+m+1,greater<int>());

    f[0][0]=1;

    for(int i=1;i<=m;i++)

        for(int j=0;j<(1<<n);j++)

		{

            f[i][j]=(f[i][j]+f[i-1][j])%MOD;

            for(int k=0;k<n;k++)

			{

                if(j&(1<<k)) continue;

                if((1<<n)-j-a[i]<(1<<k)-1) break;

                f[i][j|(1<<k)]=(f[i][j|(1<<k)]-f[i-1][j]*C((1<<n)-j-a[i],(1<<k)-1)%MOD*fac[1<<k]%MOD+MOD)%MOD;

            }

        }

    long long ans=0;

    for(int i=0;i<(1<<n);i++)

        ans=(f[m][i]*fac[(1<<n)-i-1]%MOD+ans)%MOD;

    ans=(ans*(1<<n)%MOD)%MOD;

    printf("%lld",ans);

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>



const int MAXN = (1<<16);

const int MOD = int(1E9) + 7;



int pow_mod(int b, int p) {

	int ret = 1;

	while( p ) {

		if( p & 1 ) ret = 1LL*ret*b%MOD;

		b = 1LL*b*b%MOD;

		p >>= 1;

	}

	return ret;

}



int fct[MAXN + 5], ifct[MAXN + 5];

void init() {

	fct[0] = 1;

	for(int i=1;i<=MAXN;i++)

		fct[i] = 1LL*fct[i-1]*i%MOD;

	ifct[MAXN] = pow_mod(fct[MAXN], MOD - 2);

	for(int i=MAXN-1;i>=0;i--)

		ifct[i] = 1LL*ifct[i+1]*(i+1)%MOD;

}

int comb(int n, int m) {

	return 1LL*fct[n]*ifct[m]%MOD*ifct[n-m]%MOD;

}



int f[MAXN + 5], dp[MAXN + 5];

int lowbit(int x) {

	return x & -x;

}



int A[16], N, M, t;

int main() {

	init();

	scanf("%d%d", &N, &M), t = (1 << N);

	for(int i=0;i<M;i++)

		scanf("%d", &A[i]);

	dp[0] = f[0] = 1;

	for(int i=1;i<t;i++)

		f[i] = 1LL*comb(i, lowbit(i))*f[i^lowbit(i)]%MOD;

	for(int i=M-1;i>=0;i--) {

		for(int s=t-1;s>=0;s--) {

			int p = (t - A[i]) - s;

			for(int j=0;j<N;j++) {

				int q = (1 << j);

				if( !(s & q) && p >= q - 1 )

					dp[s|q] = (dp[s|q] + MOD - 1LL*dp[s]*comb(p,q-1)%MOD) % MOD;

			}

		}

	}

	int ans = 0;

	for(int i=0;i<t;i++) ans = (ans + 1LL*dp[i]*f[t-1-i]%MOD) % MOD;

	for(int i=0;i<N;i++) ans = 1LL*ans*fct[1 << i] % MOD;

	printf("%lld\n", 1LL*ans*t%MOD);

}

// Fastest known solution for this problem: