Verify the birth number
JavaScript (ES2016), 275 259 255 254 252 Bytes

Golfed:


f=(g,I)=&gt;{[,d,m,y,i,k]=/(..)(..)(..)(...)(..)/.exec(I.padEnd(12)),v=g.charCodeAt()%2!=i%2|y&lt;=39&amp;i&lt;500,s=k=&gt;11-([...I].slice(0,-2).map((e,i)=&gt;e*[..."376189452543276543"][i+!k|9]).reduce((a,b)=&gt;a+b)+2*k)%11,[s(0),s(s(0))].map((s,i)=&gt;v&amp;=k[i]!=s);return!v}


Tests:


for (let args of [
    ["M", "01010099931"], // true
    ["F", "01029042620"], // true
    ["M", "0101009841"],  // false
    ["F", "01010051866"], // true
    ["F", "08021690849"], // true
    ["M", "01029040105"], // true
    ["M", "01029037473"]  // false
]) {
    console.log(f(...args));
}


Ungolfed:

let f = (g, input) =&gt; {

    /* Sanitize input, destructure arguments via RegExp */
    let [, d, m, y, i, k] = /(..)(..)(..)(...)(..)/.exec(input.padRight(12));

    /* Validate gender and year */
    let violation = g.charCodeAt() % 2 != i % 2 | y &lt;= 39 &amp; i &lt; 500;

    let n = [..."376189452543276543"];
    /* This function computes k1 if given no arguments, k2 if given one argument */
    let s = k =&gt; 11 - ([...input].slice(0, -2).map((e, i) =&gt; e * n[i + !k | 9]).reduce((a, b) =&gt; a + b) + 2 * k) % 11;

    /* Validate the control numbers k */
    [s(0), s(s(0))].map((s, i) =&gt; violation &amp;= k[i] != s);

    return !violation;
}