#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  if (n >= 2 * m)
    cout << m << endl;
  else {
    if (m >= 2 * n)
      cout << n << endl;
    else
      cout << (m + n) / 3 << endl;
  }
  return 0;
}
