#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, z = 0, w = 0;
  cin >> n >> m;
  if (n == 1 || n == 3 || n == 5 || n == 7 || n == 8 || n == 10 || n == 12)
    z = 31;
  else if (n == 2)
    z = 28;
  else
    z = 30;
  z += m - 1;
  w = z / 7;
  if (z % 7 != 0) w++;
  cout << w;
  return 0;
}
