#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
using namespace std;
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    int a = (m + n) / 3;
    int ans = min(a, min(n, m));
    printf("%d\n", ans);
  }
  return 0;
}
