#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define ss second
#define ff first
#define mod 1000000007
#define w(x) ll x; cin>>x; while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define re(i, j) fo(i, 0, j, 1)
#define pi acos(-1)
#define all(cont) cont.begin(), cont.end()
#define countbit(x) __builtin_popcount(x)
#define mod 1000000007
#define de(n) ll n;cin>>n;
#define def(a,n) ll n;cin>>n;ll a[n];re(i,n){cin>>a[i];}
#define defi(a,n,k) ll n;cin>>n; ll k;cin>>k;ll a[n];re(i,n){cin>>a[i];}
#define deb(x) cout<<#x<<"="<<x<<endl;
#define tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define nl cout<<endl;
using namespace std;
//18-1326D1 1208B 845C 912B 1009B 1350C 20C 1333C 1234D 1327C 1305B 1304B (or in matrix) 1216-C(26) 21
void cp()
{
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); 
    #ifndef ONLINE_JUDGE  
    freopen("input.txt", "r", stdin);  
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
	//cp();
	//w(x)
	{
		de(a);
		de(b);
		de(c);
		ll m=998244353;
		ll ans=1;
		if(a%2==0)
		{
			ans=((ans%m)*(a/2)%m)%m;
			ans=((ans%m)*(a+1)%m)%m;
		}
		else
		{
			ans=((ans%m)*((a+1)/2)%m)%m;
			ans=((ans%m)*(a)%m)%m;
		}
		if(b%2==0)
		{
			ans=((ans%m)*(b/2)%m)%m;
			ans=((ans%m)*(b+1)%m)%m;
		}
		else
		{
			ans=((ans%m)*((b+1)/2)%m)%m;
			ans=((ans%m)*(b)%m)%m;
		}
		if(c%2==0)
		{
			ans=((ans%m)*(c/2)%m)%m;
			ans=((ans%m)*(c+1)%m)%m;
		}
		else
		{
			ans=((ans%m)*((c+1)/2)%m)%m;
			ans=((ans%m)*(c)%m)%m;
		}
		cout<<ans;
	}
}
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define pb push_back
#define fo(i, start, end) for (ll i = start; i < end; i++)
#define rep(i, start, end, step) for (ll i = start; i < end; i += step)
#define print(x) cout << #x << " is " << x << endl
#define all(arg) arg.begin(), arg.end()
#define sz(arg) (int)arg.size()

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

void solve() {
    int n, m;
    cin >> n >> m;
    int a;
    vector<vi> mp(n);
    fo(i, 0, n) mp[i].push_back(-1);
    fo(i, 0, n) {
        cin >> a;
        mp[a].push_back(i);
    }
    fo(i, 0, n) mp[i].push_back(n);
    fo(i, 0, n) {
        fo(j, 1, (ll)mp[i].size()) {
            if (mp[i][j] - mp[i][j - 1] > m) {
                cout << i << endl;
                return;
            }
        }
    }
    cout << n << endl;
}

int main() {
#ifndef DEBUG
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    solve();
    return 0;
}
