#include <bits/stdc++.h>
using namespace std;
int m, d;
int cnt;
inline int days(int x) {
  if (x == 2) return 28;
  if (x <= 7)
    return (x & 1) ? 31 : 30;
  else
    return (x & 1) ? 30 : 31;
}
int main() {
  scanf("%d %d", &m, &d);
  m = days(m);
  printf("%d\n", (m + d - 2) / 7 + 1);
  return 0;
}
