#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int maxn = 5e5 + 10;
int main() {
  int n, m;
  while (cin >> n >> m) {
    printf("%d\n", min(n, min(m, (m + n) / 3)));
  }
  return 0;
}
