#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int i, j, n;
  int k, t;
  cin >> k >> t;
  int r;
  for (r = 1; r <= 1000; r++) {
    if (r * k % 10 == 0) {
      cout << r << "\n";
      return 0;
    }
    if ((r * k - t) % 10 == 0) {
      cout << r << "\n";
      return 0;
    }
  }
  return 0;
}
