#include <bits/stdc++.h>
using namespace std;
int ar[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  ios::sync_with_stdio(0);
  int m, d;
  cin >> m >> d;
  cout << (ar[m] + d - 1 - 1) / 7 + 1 << endl;
}
