#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int m, d;
  scanf("%d%d", &m, &d);
  int res = arr[m - 1] + d - 1;
  int ans = ceil((double)res / 7.0);
  printf("%d\n", ans);
  return 0;
}
