#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define println(x) cout << x << endl
#define print(x) cout << x << " "
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int a, b;
    cin >> a >> b;
    REPR(i, b + 1){
        if(b / i > ceil(a / (double)i)){
            println(i);
            return 0;
        }
    }
    return 0;
}
// #include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <complex>
using namespace std;

/* alias */
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using Pi = pair<int, int>;
using Pll = pair<ll, ll>;
using T3 = tuple<int, int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;

/* REP macro */
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define srep(i, s, n) for (int i = s; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define srrep(i, s, n) for (int i = s; i <= (n); ++i)
#define vrep(i, e) for (int i = e; i >= 0; i--)

/* define short */
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define seci [](Pi a, Pi b) { return a.se < b.se; }
#define secll [](Pll a, Pll b) { return a.se < b.se; }

/* Answer YesNo */
#define YESNO(bool) if (bool) { cout << "YES" << endl; } else { cout << "NO" << endl; }
#define YesNo(bool) if (bool) { cout << "Yes" << endl; } else { cout << "No" << endl; }
#define yesno(bool) if (bool) { cout << "yes" << endl; } else { cout << "no" << endl; }

/* print */
template<typename T>void pf(const T &t) { printf("%.10f\n", t); }
template<typename T>void pf(const T &a, const T &b) { printf("%.10f %.10f\n", a, b); }

template<typename T>void pr(const T &t) { cout << t << endl; }
template<typename T>void pr(const T &a, const T &b) { cout << a << " " << b << endl; }
template<typename T>void pr(const pair<T, T> &p) { cout << p.fi << " " << p.se << endl; }
template<typename T>void pr(const vector<T> &a) { for (T t : a) { cout << t << " "; } cout << endl; }
template<typename T>void pr(const vector<vector<T> > &a) { for (auto t : a) { pr(t); } }
template<typename T>void pr(const vector<pair<T, T> > &a) { for (auto p : a) { pr(p); } }
template<typename T>void pr(const map<T, T> mp) { for (pair<T, T> p : mp) { pr(p); } }  

/* other */
template<typename T>ll sum(vector<T> &a) { ll tot = 0; for (T x : a) { tot += (ll)x; } return tot; }
template<typename T>int lowb(const vector<T> &a, const T &x) { return (int)distance(a.begin(), lower_bound(rng(a), x)); }
template<typename T>int uppb(const vector<T> &a, const T &x) { return (int)distance(a.begin(), upper_bound(rng(a), x)); }

/* const Num */
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
const int mod = 1e9 + 7;
const double PI = acos(-1);


int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) { cin >> a[i]; }

    map<int, int> mp;
    ll ans = 0;
    rep(j, n) {
        ans += j - mp[a[j]];
        mp[a[j]]++;
    }
    cout << ans << endl;
    return 0;
}