#include <bits/stdc++.h>
using namespace std;
const int OO = 1e9;
const double EPS = (1e-7);
int main(int argc, char *argv[]) {
  int m, d;
  cin >> m >> d;
  int n = 0;
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    n = 31;
  } else if (m == 2) {
    n = 28;
  } else {
    n = 30;
  }
  int ans = (n + d - 1) / 7;
  if ((n + d - 1) % 7 == 0) {
    cout << ans;
  } else {
    cout << ans + 1;
  }
  return 0;
}
