#include <bits/stdc++.h>

using namespace std;

#define int long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n";
#define rep(i, a, b) for (int i=a; i<b; i++)
#define pre(i, a, b) for (int i=a; i>=b; i--)

const int MAX_N = 1e5+5;
const int MOD = 1e9 + 7;
const int INF = 1e9;

#define pb push_back
#define fi first
#define se second
#define pii pair<int, int>

void solve() {
	int n,k; cin>>n>>k;

	rep(i,0,k){
		if(!(n%200)){
			n /= 200;
		} else {
			string temp = to_string(n) + "200";
			n = stoll(temp);
		}
	}
	cout<<n;
}

signed main() {
    fast

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    cout.precision(10);
    cout<<fixed;

    int t = 1;
    // cin >> t;

    for (int i = 1; i <= t; i++) {
        // cout << "Case #" << i  << ": ";
        solve();
    }
}

        

/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 61;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[201][12];

void cmemoInit(){
    rep(i, 201){
        rep(j, 13){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
ll n, m;
vector<ll> a, b;
ll dp[1010][1010] = {0};
ll rec(ll i, ll j){
    if(i == n && j == m) return 0;
    if(i >= n || j >= m) return m - j + n - i;

    if(dp[i][j] != -1) return dp[i][j];
    ll res = INF;
    if(a[i] == b[j]){
        res = min(res, rec(i + 1, j + 1));
    }
    res = min(res, rec(i + 1, j) + 1);
    res = min(res, rec(i, j + 1) + 1);
    res = min(res, rec(i + 1, j + 1) + 1);
    



    return dp[i][j] = res;
}
int main(void){
    cin >> n >> m;
    a.resize(n);
    b.resize(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    rep(i, 1010) rep(j, 1010) dp[i][j] = -1;

    cout << rec(0, 0) << endl;

   

}