stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<stdio.h>

#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b;

    if((a==1 && b==2) || (a==2 && b==1))

        cout<<"3"<<endl;

    else if((a==2 && b==3) || (a==3 && b==2))

        cout<<"1"<<endl;

    else if((a==3 && b==1) || (a==1 && b==3))

        cout<<"2"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.252550261871046x):
#include<stdio.h>

int main()

{

	int A,B;

	scanf("%d %d", &A, &B);

	printf("%d\n", 6 - A - B);

	return 0 ;

	

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int x, y, z;

int main() {

    x>=1 && x<=3 && y>=1 && y<=3;

    cin >> x >> y;

    z = 6 - (x+y);

    cout << z << endl;

   

}


// Faster C++ solution for the same problem (measured speedup: 5.261199808049554x):
#include<stdio.h>

int main()

{

	int A,B;

	scanf("%d %d", &A, &B);

	printf("%d\n", 6 - A - B);

	return 0 ;

	

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#define lli long long int

#include<climits>

#include<unordered_map>

#include<algorithm>

#include<bitset>

#include<map>

#define pb push_back

using namespace std;



int main()

{

   

    int a,b;

    cin>>a>>b;

    vector<bool>arr(4);

    arr[a] = true;

    arr[b] = true;

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

        if(!arr[i])  cout<<i<<endl;

    

}




// Faster C++ solution for the same problem (measured speedup: 5.270103276405698x):
#include<stdio.h>

int main()

{

	int A,B;

	scanf("%d %d", &A, &B);

	printf("%d\n", 6 - A - B);

	return 0 ;

	

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main() {

	// your code goes here

	int b,c;

	cin>>b>>c;

	if(abs(b-c)==2)

	cout<<2;

	else if((b==1||b==2)&&(c==1||c==2))

	cout<<3;

	else

	cout<<1;

}


// Faster C++ solution for the same problem (measured speedup: 5.253783808449941x):
#include<stdio.h>

int main()

{

	int A,B;

	scanf("%d %d", &A, &B);

	printf("%d\n", 6 - A - B);

	return 0 ;

	

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define vll vector<pair<ll, ll> >

#define vl vector<ll>

#define vi vector<int>

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

const ll mod = 1e9 + 7;

const ll inf = LLONG_MAX;

using namespace std;



ll power_mod(ll x, ll y, ll p)

{

	ll ans = 1;

	x = x%p;

	if(x==0)

	return p;



	while(y>0)

	{

		if(y&1)

		{

			ans = (ans*x)%p;

		}

		y = y>>1;

		x = (x*x)%p;

	}

	return ans;

} 



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	ll i,j,k,l,m,n;

	ll a,b,c;

	cin>>a>>b;

	cout<<6-a-b;

	

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3198963114307665x):
#include<stdio.h>

int main()

{

	int A,B;

	scanf("%d %d", &A, &B);

	printf("%d\n", 6 - A - B);

	return 0 ;

	

}
// Slower C++ solution:




#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

 

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'

#define mset(d,val) memset(d,val,sizeof(d))

#define setp(x) cout<<fixed<<setprecision(x)

#define forn(i,a,b) for(int i=a;i<b;i++)

#define fore(i,a,b) for(int i=a;i<=b;i++)

#define pb push_back

#define mp make_pair

#define F first

#define S second

#define INF ll(1e18)

#define MOD 998244353

#define pqueue priority_queue

#define fbo find_by_order

#define ook order_of_key

typedef long long ll;

typedef pair<ll,ll> ii;

typedef vector<ll> vi;

typedef vector<ii> vii;

typedef long double ld;

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

 

#define MAXN 1000000007

 

 

int main() {

	ll a,b;

	cin>>a>>b;

	if ((a+b)==3) {

		cout<<3;

	}

	if ((a+b)==4) {

		cout<<2;

	}

	if ((a+b)==5) {

		cout<<1;

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.31525550990248x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long



 

using namespace std;

int main()

{

	int a, b; 

	cin >> a >> b;

	cout << 6/(a*b); 

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.315417894482797x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include<iostream>



using namespace std ;



int main()



{

    int a,b ;



    cin>>a>>b  ;



    if(a==1 && b==2 ||a==2 &&b==1)

    {

        cout<<"3"<<endl ;

    }

    else if(a==1 && b==3 ||a==3 &&b==1)

    {

        cout<<"2"<<endl ;

    }



    else if(a==3 && b==2 ||a==2 &&b==3)

    {

        cout<<"1"<<endl ;

    }



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.315902068690168x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int a, b ;



int main (){

   cin>>a;

   cin>>b;

   cout<< 6-a-b;



}

// Faster C++ solution for the same problem (measured speedup: 5.317776195314385x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
//بسم الله الرحمن الرحيم

//* In The Name 0f ALLAH *//* The Most Beneficent *//* The Most Merciful *//*

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define el << endl

#define PI 3.141592653589793238

#define _test_ int t; cin >> t; while(t--)

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }

ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }

int dx[]={0,0,+1,-1,+1,-1,-1,+1};

int dy[]={+1,-1,0,0,+1,-1,+1,-1};

///*......................*//* LET'S BEGIN (-_^) *//*............................///

const int mx=1e5+123;

ll b,ans;



void _case_()

{

    int a,b;

    cin >> a >> b;

    cout << (6-(a+b)) el;

}



int main()

{

    //file();

    optimize();

    //_test_

        _case_();



    return 0;

}



///////////*  N A Y E M  *///////////

// Faster C++ solution for the same problem (measured speedup: 5.3854175667341035x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define scan($) scanf("%d",&$)

#define test() int $;scan($);while($--)

using namespace std;

int main()

{

    int a,b;

    scanf("%d %d",&a,&b);

    printf("%d\n",6-(a+b));

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.259471192379545x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b;

    if((a==1 && b==2) || (a==2 && b==1))

        cout<<"3"<<endl;

    else if((a==2 && b==3) || (a==3 && b==2))

        cout<<"1"<<endl;

    else if((a==3 && b==1) || (a==1 && b==3))

        cout<<"2"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.315902068690168x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int x, y, z;

int main() {

    x>=1 && x<=3 && y>=1 && y<=3;

    cin >> x >> y;

    z = 6 - (x+y);

    cout << z << endl;

   

}


// Faster C++ solution for the same problem (measured speedup: 5.32465593835941x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#define lli long long int

#include<climits>

#include<unordered_map>

#include<algorithm>

#include<bitset>

#include<map>

#define pb push_back

using namespace std;



int main()

{

   

    int a,b;

    cin>>a>>b;

    vector<bool>arr(4);

    arr[a] = true;

    arr[b] = true;

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

        if(!arr[i])  cout<<i<<endl;

    

}




// Faster C++ solution for the same problem (measured speedup: 5.333666792800255x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main() {

	// your code goes here

	int b,c;

	cin>>b>>c;

	if(abs(b-c)==2)

	cout<<2;

	else if((b==1||b==2)&&(c==1||c==2))

	cout<<3;

	else

	cout<<1;

}


// Faster C++ solution for the same problem (measured speedup: 5.317150493261785x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define vll vector<pair<ll, ll> >

#define vl vector<ll>

#define vi vector<int>

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

const ll mod = 1e9 + 7;

const ll inf = LLONG_MAX;

using namespace std;



ll power_mod(ll x, ll y, ll p)

{

	ll ans = 1;

	x = x%p;

	if(x==0)

	return p;



	while(y>0)

	{

		if(y&1)

		{

			ans = (ans*x)%p;

		}

		y = y>>1;

		x = (x*x)%p;

	}

	return ans;

} 



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	ll i,j,k,l,m,n;

	ll a,b,c;

	cin>>a>>b;

	cout<<6-a-b;

	

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3840603891866765x):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



const int D = 4;

const int MODN = 1e9 + 7;



struct M {

	int d[D][D];

	M() {

		memset(d, 0, sizeof d);

	}

	M operator*(const M& other) const {

		M ret;

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

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

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

					ret.d[i][k] = (1LL * d[i][j] * other.d[j][k] + ret.d[i][k]) % MODN;

				}

		return ret;

	}

};



M pw(M x, int n) {

	M ret;

	for (int i = 0; i < D; ++ i) ret.d[i][i] = 1;

	for (; n; n >>= 1, x = x * x)

		if (n & 1) ret = ret * x;

	return ret;

}



int main() {

	std::ios::sync_with_stdio(false);

	M T, cur, Tb;

	for (int i = 0; i < D; ++ i) cur.d[i][i] = 1;

	T.d[0][3] = 1;

	T.d[1][1] = T.d[1][3] = 1;

	T.d[2][1] = T.d[2][2] = T.d[2][3] = 1;

	T.d[3][1] = 1; T.d[3][2] = T.d[3][3] = 2;



	Tb.d[1][1] = 1;

	Tb.d[2][1] = Tb.d[2][2] = 1;

	Tb.d[3][1] = 1; Tb.d[3][2] = 2; Tb.d[3][3] = 1;



	int n, m; std::cin >> n >> m;

	int last = 0;

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

		int x; std::cin >> x;

		cur = pw(T, x - last - 1) * cur;

		cur = Tb * cur;

		last = x;

	}



	cur = pw(T, n - last) * cur;

	int ans = 0;

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

		ans = (ans + cur.d[0][i]) % MODN;

	std::cout << ans << std::endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.242935745378682x):
#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<stack>

#include<vector>

#include<queue>

#include<bitset>

#include<map>

using namespace std;



#define LL long long

#define DB double

#define MOD 1000000007

#define Pr pair<DB,int>

#define X first

#define Y second

#define mem(x,p) memset(x,p,sizeof(x))



LL read(){

  LL x=0,F=1;char c=getchar();

  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}

  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}

  return x*F;

}



int add(int a,int b){return (a+b>=MOD)?a+b-MOD:a+b;}

int dec(int a,int b){return (a-b<0)?a-b+MOD:a-b;}

int mul(int a,int b){return 1LL*a*b%MOD;}

LL pabs(int x){

    return (x<0)?-x:x;

}



int T;

int n,m,pre;



struct Matrix{

    int ma[3][3];

    Matrix(){mem(ma,0);}

};



void init(Matrix &K)

{

	K.ma[0][0]=1;//c->c

    K.ma[1][0]=1;K.ma[1][1]=1;//b(x+1)->bx+b

    K.ma[2][0]=1;K.ma[2][1]=2;K.ma[2][2]=1;//cx^2->cx^2+2cx+c

}



Matrix mul(Matrix A,Matrix B)

{

	Matrix C;

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

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

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

            C.ma[i][j]=add(C.ma[i][j],mul(A.ma[i][k],B.ma[k][j]));

	return C;

}



Matrix fs_pow(Matrix A,LL k)

{

	Matrix B;

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

    B.ma[i][i]=1;

	while(k) {

        if(k&1) B=mul(B,A);

        A=mul(A,A);

        k>>=1;

    }

    return B;

}



int main()

{

    pre=1;

    n=read(),m=read();

    Matrix A,B,Fc;

	init(A);B=A;

    B.ma[0][2]++,B.ma[1][2]++,B.ma[2][2]++;

	Fc.ma[0][2]=1;

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

        int x=read();

        Fc=mul(Fc,fs_pow(B,x-pre));

        Fc=mul(Fc,A);

        pre=x+1;

    }

    Fc=mul(Fc,fs_pow(B,n-pre));

    printf("%d\n",add(Fc.ma[0][0],add(Fc.ma[0][1],Fc.ma[0][2])));

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <iostream>

#include <algorithm>

#define ll long long

using namespace std;

#define N 100005

#define mod 1000000007

int n, m, x[N];

struct Matrix

{

	int A[3][3];

	Matrix(){memset(A, 0, sizeof A);}

	Matrix operator * (const Matrix &b)const

	{

		Matrix c;

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

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

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

					c.A[i][j] = (c.A[i][j] + (ll)A[i][k] * b.A[k][j]) % mod;

		return c;

	}

	void Init()

	{

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

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

				A[i][j]=1;

		A[0][1] = A[2][1] = A[2][2]=2;

		A[1][0] = 0;

	}

}ans, now, oth, mat, one;

void Pow(int k)

{

	now = one;

	mat.Init();

	while (k)

	{

		if (k & 1)

			now = now * mat;

		mat = mat * mat;

		k >>= 1;

	}

}

int main()

{

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

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

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

	x[++m] = n;

	oth.Init();

	oth.A[2][1] = oth.A[2][0] = 0;

	oth.A[2][2] = 1;

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

		one.A[i][i] = 1;

	ans.A[0][0] = 1;

	Pow(x[1]);

	ans = ans * now;

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

		{

			ans = ans * oth;

			Pow(x[i + 1] - x[i] - 1);

			ans = ans * now;

		}

	printf("%d\n", ans.A[0][2]);

}


// Faster C++ solution for the same problem (measured speedup: 5.064901478511945x):
#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<stack>

#include<vector>

#include<queue>

#include<bitset>

#include<map>

using namespace std;



#define LL long long

#define DB double

#define MOD 1000000007

#define Pr pair<DB,int>

#define X first

#define Y second

#define mem(x,p) memset(x,p,sizeof(x))



LL read(){

  LL x=0,F=1;char c=getchar();

  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}

  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}

  return x*F;

}



int add(int a,int b){return (a+b>=MOD)?a+b-MOD:a+b;}

int dec(int a,int b){return (a-b<0)?a-b+MOD:a-b;}

int mul(int a,int b){return 1LL*a*b%MOD;}

LL pabs(int x){

    return (x<0)?-x:x;

}



int T;

int n,m,pre;



struct Matrix{

    int ma[3][3];

    Matrix(){mem(ma,0);}

};



void init(Matrix &K)

{

	K.ma[0][0]=1;//c->c

    K.ma[1][0]=1;K.ma[1][1]=1;//b(x+1)->bx+b

    K.ma[2][0]=1;K.ma[2][1]=2;K.ma[2][2]=1;//cx^2->cx^2+2cx+c

}



Matrix mul(Matrix A,Matrix B)

{

	Matrix C;

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

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

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

            C.ma[i][j]=add(C.ma[i][j],mul(A.ma[i][k],B.ma[k][j]));

	return C;

}



Matrix fs_pow(Matrix A,LL k)

{

	Matrix B;

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

    B.ma[i][i]=1;

	while(k) {

        if(k&1) B=mul(B,A);

        A=mul(A,A);

        k>>=1;

    }

    return B;

}



int main()

{

    pre=1;

    n=read(),m=read();

    Matrix A,B,Fc;

	init(A);B=A;

    B.ma[0][2]++,B.ma[1][2]++,B.ma[2][2]++;

	Fc.ma[0][2]=1;

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

        int x=read();

        Fc=mul(Fc,fs_pow(B,x-pre));

        Fc=mul(Fc,A);

        pre=x+1;

    }

    Fc=mul(Fc,fs_pow(B,n-pre));

    printf("%d\n",add(Fc.ma[0][0],add(Fc.ma[0][1],Fc.ma[0][2])));

}
// Slower C++ solution:
#include <bits/stdc++.h>



const int D = 4;

const int MODN = 1e9 + 7;



struct M {

	int d[D][D];

	M() {

		memset(d, 0, sizeof d);

	}

	M operator*(const M& other) const {

		M ret;

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

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

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

					ret.d[i][k] = (1LL * d[i][j] * other.d[j][k] + ret.d[i][k]) % MODN;

				}

		return ret;

	}

};



M pw(M x, int n) {

	M ret;

	for (int i = 0; i < D; ++ i) ret.d[i][i] = 1;

	for (; n; n >>= 1, x = x * x)

		if (n & 1) ret = ret * x;

	return ret;

}



int main() {

	std::ios::sync_with_stdio(false);

	M T, cur, Tb;

	for (int i = 0; i < D; ++ i) cur.d[i][i] = 1;

	T.d[0][3] = 1;

	T.d[1][1] = T.d[1][3] = 1;

	T.d[2][1] = T.d[2][2] = T.d[2][3] = 1;

	T.d[3][1] = 1; T.d[3][2] = T.d[3][3] = 2;



	Tb.d[1][1] = 1;

	Tb.d[2][1] = Tb.d[2][2] = 1;

	Tb.d[3][1] = 1; Tb.d[3][2] = 2; Tb.d[3][3] = 1;



	int n, m; std::cin >> n >> m;

	int last = 0;

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

		int x; std::cin >> x;

		cur = pw(T, x - last - 1) * cur;

		cur = Tb * cur;

		last = x;

	}



	cur = pw(T, n - last) * cur;

	int ans = 0;

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

		ans = (ans + cur.d[0][i]) % MODN;

	std::cout << ans << std::endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.301404848962796x):
#include <cstdio>

#include <assert.h>



typedef long long LL;



const int MAXM = 1e5, MOD = 1e9 + 7;

int n, m;



inline int add ( int a, const int b ) { return ( a += b ) < MOD ? a : a - MOD; }

inline int mul ( LL a, const int b ) { return ( a *= b ) < MOD ? a : a % MOD; }



inline int rint () {

	int x = 0; char s = getchar ();

	for ( ; s < '0' || '9' < s; s = getchar () );

	for ( ; '0' <= s && s <= '9'; s = getchar () ) x = x * 10 + ( s ^ '0' );

	return x;

}



struct Matrix {

	int n, m, mat[3][3];

	Matrix (): n ( 0 ), m ( 0 ), mat {} {}

	Matrix ( const int tn, const int tm ): n ( tn ), m ( tm ), mat {} {}

	inline int* operator [] ( const int key ) { return mat[key]; }

	inline Matrix operator * ( Matrix t ) {

		assert ( m == t.n );

		Matrix ret ( n, t.m );

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

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

				for ( int j = 0; j < t.m; ++ j ) {

					ret[i][j] = add ( ret[i][j], mul ( mat[i][k], t[k][j] ) );

				}

			}

		}

		return ret;

	}

};



inline Matrix qkpow ( Matrix a, int b ) {

	Matrix ret ( a.n, a.m );

	for ( int i = 0; i < ret.n; ++ i ) ret[i][i] = 1;

	for ( ; b; a = a * a, b >>= 1 ) if ( b & 1 ) ret = ret * a;

	return ret;

}



Matrix I ( 3, 1 ), A ( 3, 3 ), B ( 3, 3 );



inline void init () {

	I[0][0] = 1;

	A[0][0] = 1;

	A[1][0] = 2, A[1][1] = 1;

	A[2][0] = A[2][1] = A[2][2] = 1;

	B = A, ++ B[0][0], ++ B[0][1], ++ B[0][2];

}



int main () {

	init ();

	n = rint (), m = rint ();

	int las = 0;

	for ( int i = 1, x; i <= m; ++ i ) {

		x = rint ();

		I = A * qkpow ( B, x - las - 1 ) * I;

		las = x;

	}

	

	I = A * qkpow ( B, n - las - 1 ) * I;

	printf ( "%d\n", I[2][0] );

	return 0;

}