#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int tmp;
  for (int i = 0;; i++) {
    tmp = i * 10;
    if (tmp % n == 0 && tmp) {
      printf("%d\n", tmp / n);
      return 0;
    }
    tmp += m;
    if (tmp % n == 0) {
      printf("%d\n", tmp / n);
      return 0;
    }
  }
}
