#include <bits/stdc++.h>
using namespace std;
int m, d, x, month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
void solve() {
  scanf("%d%d", &m, &d);
  printf("%d\n", (month[m - 1] + (d - 1) + 6) / 7);
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
