#include <iostream>

using namespace std;

int main() {
  double a, b;
  int k;
  cin >> a >> b;
  k = a / b;
  cout << a - k * b;
  return 0;
}