#include <bits/stdc++.h>
using namespace std;
const int MAX = 200001;
const int INF = 1000000001;
int main() {
  int m, d;
  cin >> m >> d;
  int a[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  cout << (a[m] + d + 5) / 7 << endl;
  return 0;
}
