#include <bits/stdc++.h>
using namespace std;
long long n, m, a, b;
int main() {
  cin >> n >> m;
  a = (n + m) / 3;
  n = min(n, m);
  if (a <= n)
    cout << a << endl;
  else
    cout << n << endl;
  return 0;
}
