#include <bits/stdc++.h>
using namespace std;
const double eps = 0.000000000000001;
int M[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int m, d;
  scanf("%d%d", &m, &d);
  int ans = M[m] + d - 1;
  ans = (ans / 7 + (ans % 7 > 0 ? 1 : 0));
  printf("%d\n", ans);
  return 0;
}
