#include <bits/stdc++.h>
using namespace std;
int n, m;
int res;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  int res = 0;
  cout << min(n + m, min(m, min(n, (n + m) / 3)));
}
