Language: C++

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

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define ll              long long int
#define ull             unsigned long long
#define vi              vector<int>
#define vl              vector<ll>
#define vvi             vector<vector<int> >
#define pi              pair<int,int>
#define vii             vector<pi>

#define sz(v)           ((int)(v).size())
#define all(s)          s.begin(),s.end()
#define allr(s)         s.rbegin(),s.rend()
#define unq(c)          (sort(all(c)), c.resize(distance(c.begin(),unique(all(c)))))
#define get_pos(c,x)    (lower_bound(all(c),x)-c.begin())

#define MS0(v)          memset((v), 0, sizeof((v)))
#define MS1(v)          memset((v), -1, sizeof((v)))
#define LEN(v)          strlen(v)

#define MP              make_pair
#define pb              push_back
#define pob             pop_back
#define ff              first
#define ss              second
#define sc              scanf
#define pf              printf
#define endl            "\n"

#define TEST_CASE       int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define PRINT_CASE      printf("Case %d: ",cs)

#define vpf(v)          for(int i=0;i<v.size();i++){cout<<v[i];if(i!=v.size()-1)cout<<" ";else cout<<"\n";}
#define vsc(v)          for(int i=0;i<v.size();i++)cin>>v[i];

#define REP(i, n)       for (int i = 0; i < (n); i++)
#define REPP(i, a, b)   for (int i = (a); i < (b); i++)
#define FOR(i, a, b)    for (int i = (a); i <= (b); i++)
#define FORS(i, s)      for (int i = 0; s[i]; i++)

#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fileio          freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)

#define intlim          2147483648
#define infinity        (1LL<<50)

#define gcd(a, b)       __gcd(a, b)
#define lcm(a, b)       ((a)*((b)/gcd(a,b)))


int on_bit(int N,int pos){return N = N | (1<<pos);}
int off_bit(int N,int pos){return N = N & ~(1<<pos);}
bool check_bit(ll N,int pos){return (bool)(N & (1<<pos));}


#define start_clock     clock_t tStart = clock()
#define end_clock       printf("\n>>Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC)



//____________________________________________________________________________________________________________




int main(){ 
    int k, n;
    cin >> k >> n;
    vi v(n), a;
    vsc(n);
    sort(all(v)); a = v;

    for(int i=n-1;i>0;i--){
        a[i] -= a[i-1];
    }
    a[0]=0;

    int mx = 0, idx;

    for(int i=1;i<n;i++){
        if(a[i] - a[i-1] > mx){
            mx = a[i] - a[i-1];
            idx = i;
        }
    }

    int x = k - v.back() + v.front();

    if(x > mx) cout<<a.back()<<"\n";
    else  cout << k - v[idx] + v[idx-1] <<"\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:41: error: request for member 'size' in 'n', which is of non-class type 'int'
   39 | #define vsc(v)          for(int i=0;i<v.size();i++)cin>>v[i];
      |                                         ^~~~
a.cc:75:5: note: in expansion of macro 'vsc'
   75 |     vsc(n);
      |     ^~~
a.cc:39:58: error: invalid types 'int[int]' for array subscript
   39 | #define vsc(v)          for(int i=0;i<v.size();i++)cin>>v[i];
      |                                                          ^
a.cc:75:5: note: in expansion of macro 'vsc'
   75 |     vsc(n);
      |     ^~~