#include <bits/stdc++.h>
int main() {
  int m, d, n;
  scanf("%d%d", &m, &d);
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
    m = 31;
  else if (m == 2)
    m = 28;
  else
    m = 30;
  if ((m - (7 - d + 1)) % 7 == 0)
    n = (m - (7 - d + 1)) / 7;
  else
    n = (m - (7 - d + 1)) / 7 + 1;
  printf("%d", n + 1);
}
